import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

import org.korifey.ffalg.NumberTheory;
import org.korifey.ffalg.Probabilities;


public class Problem22 {
	
	public static void main(String[] args) throws IOException {
		System.out.println(solve("Problem22.in"));
	}
	static int n = 100;
		
	public static long solve(String filename) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(Problem13.class.getClassLoader().getResourceAsStream(filename)));
		String s = reader.readLine().replace("\"", "");
		String[] ss = s.split(",");
		Arrays.sort(ss);
			
		long res = 0;
		for (int i=0; i<ss.length; i++) {
			long acc = 0;
			for (char c: ss[i].toCharArray()) {
				acc += c - 'A'+1;
			}
			res += acc*(i+1);
		}
		return res;
	}
	
}
